Widget events

onMouseClick

void onMouseClick (me, eventInfo)

This event is available only for buttons and it occurs when the button is pressed and released quickly.

Parameter Description
me Object triggering the event
eventInfo Details of triggered event

function buttonStd1_onMouseClick(me, eventInfo) {

//do something…

}

onMouseHold

void onMouseHold (me, eventInfo)

This event is available only for buttons and it occurs when the button is pressed and released after the number of seconds set as Hold Time in the widget properties.

Parameter Description
me Object triggering the event
eventInfo Details of triggered event

function buttonStd1_onMouseHold(me, eventInfo) {

//do something…

}

onMousePress

void onMousePress(me, eventInfo)

This event is available only for buttons and it occurs when the button is pressed.

Parameter Description
me Object triggering the event
eventInfo Details of triggered event

function buttonStd1_onMousePress(me, eventInfo) {

//do something…

}

onMouseRelease

void onMouseRelease (me, eventInfo)

This event is available only for buttons and it occurs when the button is released.

Parameter Description
me Object triggering the event
eventInfo Details of triggered event

function buttonStd1_onMouseRelease(me, eventInfo) {

//do something…

}

onDataUpdate

boolean onDataUpdate (me, eventInfo)

This event occurs when data attached to the widget changes.

Parameter Description
me Object triggering the event
eventInfo

An object with the fields listed below (you can refer fields using “.” - dot notation)

oldValue = Widget value before the change

newValue = Value which will be updated to the widget

attrName = Attribute on which the event is generated

index = Integer attribute index if any, default = 0

mode = When the user is writing to the widget. R in all others status.

The event is triggered before the value is passed to the widget. A JavaScript code can intercept the event and decide to avoid to update the widget by return true value.

Note: if there are additional macros associate at the event, all macros will be execute regardless of the return value used inside the JavaScript code.

function buttonStd1_onDataUpdate(me, eventInfo) {
if ( eventInfo.newValue > 100) {
   //do something...
   return true;  // To avoid to continue and update 
                 // the widget (e.g. not update the linked tag)
}
   return false; // To continue and update the widget 
                 // (e.g. update the linked tag)
}